#include <lpc23xx.h>
#include "LCD.h"
//define the IRQ interrupt handler
void EXTINTVectoredIRQ (void)__irq; 	

int main (void)
{

PINSEL0     = 0x00000000;
PINSEL1     = 0x00000000;
PINSEL2     = 0x00000000;
PINSEL3     = 0x00000000;
PINSEL4     = 0x00000000;
PINSEL5     = 0x00000000;
PINSEL6     = 0x00000000;
PINSEL7     = 0x00000000;
PINSEL8     = 0x00000000;
PINSEL9     = 0x00000000;
PINSEL10    = 0x00000000;
IODIR0      = 0x00000000;
IODIR1      = 0x00000000;
IOSET0      = 0x00000000;
IOSET1      = 0x00000000;
 
FIO2DIR     = 0x000000FF;                 //Configure the LED IO pins
FIO2MASK    = 0xFFFFFF00;
FIO2CLR     = 0x000000FF;   

PINSEL4 	= 0x00100000;						        //Enable the EXTINT1 interrupt

VICVectPriority14 	= 0x00000000;  				//Set Slot 14 to the highest priority
VICVectAddr14	= (unsigned)EXTINTVectoredIRQ;  //pass the address of the IRQ into the VIC slot
VICIntEnable 	= 0x00004000;					      //enable interrupt

    lcd_init();					   //
	lcd_clear();				  //
	set_cursor(2,0);			   // Agaf=/
    lcd_print("IRQ Interrupt");	 //
    set_cursor(5,1);
	lcd_print("Example");

while(1)
{
FIO2SET         = 0x000000F0;                       //Switch on the upper nibble of LEDs;													                //Idle
FIO2CLR			= 0x0000000F;						//Agaf
}

return(0);
}

void EXTINTVectoredIRQ (void)__irq  
{

FIO2SET         = 0x0000000F;           //Switch on thelower nibble LEDs

EXTINT  		= 0x00000001;					      //Clear the peripheral interrupt flag
VICVectAddr 	= 0x00000000;					   //Dummy write to signal end of interrupt
}
    
